<template>
    <BPTable ref='tableRef' align='center' row-key='id' :columns='columns' :api='pageApi' :buttons='buttons'>
        <template #user="{record}">
            {{ record.user.nickname }}
        </template>
    </BPTable>
</template>

<script lang='ts' setup>
    import { ref } from "vue";
    import { pageApi } from '@/api/recharge/Order'
    import { parseTime } from "@/utils";
import { CLIENT_SOURCE } from "@/constant";

    CLIENT_SOURCE

    const tableRef = ref()


    const buttons = ref<SearchButton[]>([])

    const columns = ref<Column[]>([
        {
            dataIndex : 'orderNo',
            title : '订单号',
            inSearch : true,
        },

        {
            dataIndex : 'user',
            title : '用户',
        },

        {
            dataIndex : 'payChannel',
            title : '支付方式',
            customRender({text}) {
                return CLIENT_SOURCE[text]
            }
        },

        {
            dataIndex : 'amount',
            title : '充值金额(元)',
        },

        {
            dataIndex : 'rewardAmount',
            title : '赠送金额(元)',
        },

        {
            title : '时间',
            dataIndex : 'createTime',
            align : 'center',
            customRender({text}) {
                return parseTime(text)
            }
        }
    ])

    const dataRows = ref<any[]>([])
    
</script>